// element-plus 国际化文件
import element_zh_hk from "element-plus/es/locale/lang/zh-hk";
import element_zh_cn from "element-plus/es/locale/lang/zh-cn";
import element_en from "element-plus/es/locale/lang/en";

// 框架 国际化文件
import zh_hk from "./lang/zh-HK";
import zh_cn from "./lang/zh-CN";
import en_us from "./lang/en-US";

// 加载 lang 文件夹下的国际化
export const loadLang = (modules: Record<string, any>) => {
  let messages: { [key: string]: string } = {};

  Object.keys(modules).forEach((module) => {
    Object.assign(messages, { ...modules[module].default });
  });

  return messages;
};

export const messages: { [key: string]: any } = {
  "zh-HK": {
    langName: "繁体中文",
    ...loadLang(zh_hk),
    el: {
      ...element_zh_hk,
    },
  },
  "zh-CN": {
    langName: "简体中文",
    ...loadLang(zh_cn),
    el: {
      ...element_zh_cn,
    },
  },
  "en-US": {
    langName: "English",
    ...loadLang(en_us),
    el: {
      ...element_en,
    },
  },
};
